//
// Description: 191. 位1的个数
// Created by Loading on 2025/4/1.
//

#include <bits/stdc++.h>

using namespace std;

int hammingWeight(int n) {
    int res = 0;
    for (int i = 0; i < 32 && n > 0; ++i) {
        if (n & 0x01) {
            ++res;
        }
        n >>= 1;
    }

    return res;
}

int main() {
    int n = 2147483645;

    auto res = hammingWeight(n);

    cout << res << endl;

    return 0;
}
